import { defineStore } from 'pinia'
export const useCountStore = defineStore('count', {
    //actions里面放置的是一个一个的方法，用于响应组件里面的“动作”
    actions: {
        increment(value:number,v11:string,v22:string) {
            console.log("increment被调用了", value)
            //修改数据(this是当前的store)
            if (this.sum < 10) {
                this.sum += value;
                this.school = v11;
                this.address = v22

            }
        }
    },
    //真正存储数据的地方
    state() {
        return {
            sum: 6,
            school: "wertwet",
            address: "安徽"
        }
    },
    //对数据加工
    getters:{
        // bigSum(state){
        //     return state.sum * 10
        // },
        //或者
        bigSum:state => state.sum * 10,

        // uppSchool(state){
        //     // return state.school.toUpperCase()
        //     //或者
        //     return this.school.toUpperCase()
        // }
        //或者是
        uppSchool():string{
            // return state.school.toUpperCase()
            //或者
            return this.school.toUpperCase()
        }
        
    }
})